# 定义目标文件
TARGET := target/riscv64gc-unknown-none-elf/release/os.bin

# 默认目标
build:
	@cargo build --release

process:
	rust-objcopy --strip-all target/riscv64gc-unknown-none-elf/release/os -O binary $(TARGET)

# 规则: 运行项目
run:
	qemu-system-riscv64 -machine virt -nographic -bios ../bootloader/rustsbi-qemu.bin -device loader,file=$(TARGET),addr=0x80200000

# 规则: 清理构建文件
clean:
	rm -f $(TARGET) 

# 规则: 执行所有步骤
all: clean build process run

# 伪目标，不实际创建这些文件
.PHONY: build process run clean all
